package com.lx.chat;



import com.lx.chat.biz.IMsgSender;
import com.lx.chat.biz.impl.DefaultMsgSender;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.AutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;
@SpringBootApplication
@MapperScan("com.lx.chat.dao")
//@AutoConfiguration
//@ConditionalOnProperty(prefix = "websockt", name = "enable")
//@EnableConfigurationProperties(com.lx.websockt.bean.WebsocktPropertise.class)
public class ChatApp {
    public static void main(String[] args) {
        SpringApplication.run(ChatApp.class, args);
    }

    // 启用WebSocket支持 服务端点管理
    @Bean
    public ServerEndpointExporter serverEndpointExporter() {

        return new ServerEndpointExporter();
    }

    @Bean
    @ConditionalOnMissingBean
    public IMsgSender msgSender() {
        return new DefaultMsgSender();
    }
}
